import Vue from 'vue'
import Vuex from 'vuex'
import App from './App'
import router from './router'
import store from './store'
import VueScroller from 'vue-scroller'

Vue.config.productionTip = false
Vue.use(VueScroller)
Vue.use(Vuex)

router.beforeEach((to, from, next) => {
  if (!store.getters['login/getLogin'] && to.name !== 'login') {
    next({ name: 'login' })
  }
  next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
